<?php if (!defined('BASEPATH')) { die('No direct script access allowed'); }


/**
 * Generate Youtube Player
 *
 * Takes a youtube VIdeo Link and makes a EMBED object for your site.
 *
 * @access	public
 * @param	string
 * @return	string
 */	
if (! function_exists('generateYoutubePlayer'))
{
	function generateYoutubePlayer($link)
	{
		// URLLink Format: http://youtube.com/watch?v=1e9AJVtuCKc
		// Needed Link Format: http://www.youtube.com/v/1e9AJVtuCKc&hl=en
		
		$newLink = str_replace('watch?v=', 'v/', $link);
		
		$js = '<object width="425" height="355"><param name="movie" value="'.$newLink.'"></param><param name="wmode" value="transparent"></param><embed src="'.$newLink.'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>';
		return $js;
	}
}

?>